package com.asialjim.wechat.database;

import com.asialjim.wechat.core.bean.WeChatBean;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;

/**
 * <h1><em>ASIAL JIM JAVA DOC</em></h1><hr/>
 * <h2>INTERFACE DESCRIPTION <i>[ NAME: CRUD_DataBaseService ]</i></h2><strong>
 * <p> CRUD database service
 * </strong><p><p><em>Copyright &copy; Asial Jim Co., LTD</em><hr/>
 *
 * @author Asial Jim &nbsp;&nbsp; <span>Email:<a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
 * @version 1.0.0
 * @since 2021/3/17   &nbsp;&nbsp; JDK 8
 */
public interface CRUD_DataBaseService{
    String BEAN_NAME = "crudDataBaseService";

    /**
     * <h3>METHOD DESCRIPTION <i>[ NAME: add2Table ]</i></h3>
     * add record to data base table
     * @param tableName {@link String table name}
     * @param tableInfos {@link List<DataBaseTableInfo> record}
     * @return {@link Integer mybatis result code}
     * @author Asial Jim &nbsp;&nbsp;<span>Email:asialjim@hotmail.com &nbsp;&nbsp; asialjim@qq.com</span>
     * @since 2021/3/17 17:54
     */
    int add2Table(String tableName, List<DataBaseTableInfo> tableInfos);

    /**
     * <h3>METHOD DESCRIPTION <i>[ NAME: deleteRecord ]</i></h3>
     * delete record from data base
     * @param tableName {@link String table name}
     * @param conditions {@link List<DataBaseTableInfo> record}
     * @return {@link Integer mybatis result code}
     * @author Asial Jim &nbsp;&nbsp;<span>Email:asialjim@hotmail.com &nbsp;&nbsp; asialjim@qq.com</span>
     * @since 2021/3/17 17:56
     */
    int deleteRecord(String tableName,List<DataBaseTableInfo> conditions);

    /**
     * <h3>METHOD DESCRIPTION <i>[ NAME: updateRecord ]</i></h3>
     * update record for data base
     * @param tableName {@link String table name}
     * @param conditions {@link List<DataBaseTableInfo> record}
     * @param source {@link List<DataBaseTableInfo> desc}
     * @return {@link Integer mybatis result code}
     * @author Asial Jim &nbsp;&nbsp;<span>Email:asialjim@hotmail.com &nbsp;&nbsp; asialjim@qq.com</span>
     * @since 2021/3/17 17:56
     */
    int updateRecord(String tableName,List<DataBaseTableInfo> conditions, List<DataBaseTableInfo> source);

    /**
     * <h3>METHOD DESCRIPTION <i>[ NAME: selectPage ]</i></h3>
     * select record in page from database
     * @param tableName {@link String table name}
     * @param pageNum {@link Integer page number }
     * @param pageSize {@link Integer page size}
     * @param conditions {@link List<DataBaseTableInfo> record}
     * @return {@link IPage< Object> record list in page}
     * @author Asial Jim &nbsp;&nbsp;<span>Email:asialjim@hotmail.com &nbsp;&nbsp; asialjim@qq.com</span>
     * @since 2021/3/17 17:56
     */
    IPage<Object> selectPage(String tableName,Integer pageNum,Integer pageSize,List<DataBaseTableInfo> conditions);

    /**
     * <h3>METHOD DESCRIPTION <i>[ NAME: all ]</i></h3>
     * query all records in table from data base
     * @param tableName {@link String table name}
     * @return {@link java.util.List<java.lang.Object> table name}
     * @author Asial Jim &nbsp;&nbsp;<span>Email:asialjim@hotmail.com &nbsp;&nbsp; asialjim@qq.com</span>
     * @since 2021/3/18 11:23
     */
    List<Object> all(String tableName) throws Exception;
}
